from  flask import Blueprint
from flask import redirect
from flask import request
from flask import session

admin = Blueprint('admin', __name__, url_prefix='/admin')

from . import views


@admin.before_request
def before_request():
    if request.url.endswith('/admin/index') and not session.get('is_admin'):
        return redirect('/')
